<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>我关注的人</title>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/font-awesome-4.3.0/css/font-awesome.min.css" />
		<link href="../css/config.css" rel="stylesheet" />
		<link href="../css/base.css" rel="stylesheet" />
		<link href="../css/index.css" rel="stylesheet" />
		<link href="../css/circle.css" rel="stylesheet" />
		<style>
			body {
				background: #efefef;
			}
			
			.post-master {
				margin-top: 10px;
				background: white;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav km-navbar white-header" style="box-shadow:none;">
			<a class="mui-icon mui-icon-back mui-pull-left mui-action-back"></a>
			<h1 id="title" class="mui-title km-view-title">我关注的</h1>
		</header>
		<div class="mui-content3" id="area-guanzhu">
			<!--<div class="post-master">
				<a class="img-a" href="../view/doctor-detail.html"><img src="../img/example1.png" /></a>
				<dl><dt>王医生</dt>
					<dd>内科</dd>
				</dl>
				<a class="guanzhu yiguanzhu" ontouchstart="guanzhu()">取消关注</a>
				<span class="time">02-18&nbsp;12:44</span>
			</div>
			<div class="post-master">
				<a class="img-a" href="../view/doctor-detail.html"><img src="../img/example1.png" /></a>
				<dl><dt>王医生</dt>
					<dd>内科</dd>
				</dl>
				<a class="guanzhu yiguanzhu" ontouchstart="guanzhu()">取消关注</a>
				<span class="time">02-18&nbsp;12:44</span>
			</div>-->
		</div>
	</body>
	<script src="../js/mui.min.js"></script>
	<script src="../js/dlCommon.js"></script>
	<script src="../js/config.js"></script>
	<script src="../js/Global.js"></script>
	<script src="../js/zepto.min.js"></script>
	<script>
		mui.init({
			swipeBack: true,
			statusBarBackground: '#f7f7f7',
			statusBarStyle: 'UIStatusBarStyleDefault'
		});
		mui('.mui-scroll-wrapper').scroll();
		mui.plusReady(function(){
			pullUpLoad();
		})
		//=======院所电话-点击事件
		mui('#area-guanzhu').on('tap', 'a', function() {
			var id = this.id;
			var title = this.title;
			var href = this.href;
			if (href) {
				openWindow(href, href, {
					userid: id,
					title: title
				});
			}
			else
			{
				guanzhu(this,this.getAttribute("userid"),this.getAttribute("username"),this.getAttribute("ksname"),this.getAttribute("userimage"),this.getAttribute("userlx"));
			}
		})
		function guanzhu(event,fuserid,username,ksname,userimage,userlx){
		
			if(!fuserid)
			return;
			dLong.getJSON(config.socialRoot + "Ajax/AjaxappMyFocusOn.ashx?action=add", 
		    {
		    uuid:config.uuid(),
		    userid:config.cuserid,
		    username:escape(username),
		    ksname:escape(ksname),
		    userimage:escape(userimage),
		    userlx:userlx,
		    fuserid:fuserid,
		    yyid: config.yyid,
		    key: config.key,
		    Rnd: Math.random()
		    },
		    function (obj) {
				 if(obj.Type=="Error"){
			    		dLong.toast(obj.Message);
			    		return;
			    	}
		       dLong.toast(obj.Message);
			      if(event.classList.contains("yiguanzhu")){
					event.innerText="关注";
				}else{
					event.innerText="取消关注";
				}
		      });
		}
		function pullUpLoad(){
			IsLogin();
			dLong.getJSON(config.socialRoot + "Ajax/AjaxappMyFocusOn.ashx?action=getlist", 
		    {
		    	uuid:config.uuid(),
		    	yyid: config.yyid,
		    	userid: config.cuserid,
		    	key: config.key,
		    	Rnd: Math.random()
		    },
		    function (obj) {
				 if(obj.Type=="Error"){
			    		dLong.toast(obj.Message);
			    		return;
			    	}
		        
		         var data=obj.resultList;
		         var s="";
		         mui.each(data, function(index)
		         {
		         	
					s+='<div class="post-master">';
					s+='<a id="'+data[index].userid+'" class="img-a" href="../view/doctor-detail.html">';
					var img=unescape(data[index].userimage)||"../img/admin.png";
					s+='<img src="'+img+'" />';
					s+='</a>';
					s+='<dl><dt>'+unescape(data[index].username) +'</dt>';
					s+='<dd>'+unescape(data[index].ksname)+'</dd>';
					s+='</dl>';
					s+='<a id="'+data[index].id+'" userid="'+data[index].userid+'"  ksname="'+data[index].ksname+'"  userlx="'+data[index].userlx+'" username="'+data[index].username +'" userimage="'+data[index].imgurl+'"';
					s+=' class="guanzhu yiguanzhu" >取消关注</a>';
					//s+='<span class="time">02-18&nbsp;12:44</span>';
					s+='</div>';
					
		        })
			document.getElementById("area-guanzhu").innerHTML=s;
		      });
			}
		
	</script>

</html>